<template>
  <el-row>
    <el-col :span="22" :offset="1">

      <!--卡片shart-->
      <el-card class="box-card" style="padding: 0 15px;">

        <el-row :gutter="24">
          <el-col :span="6" style="line-height: 40px">
            <div class="grid-content bg-purple">
              处方类别
              <el-select v-model="druginfo.kind" filterable placeholder="请选择">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                  <span style="float: left">{{ item.label }}</span>
                  <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
                </el-option>
              </el-select>
            </div>
          </el-col>
          <el-col :span="8" style="line-height: 40px"><div class="grid-content bg-purple">
            <el-input placeholder="请输入内容" v-model="input_search" class="input-with-select">
              <el-button slot="append" icon="el-icon-search"></el-button>
            </el-input>
          </div></el-col>
        </el-row>


        <el-table
          :data="druginfo"
          :header-cell-style="{background:'#C2C5F6',color:'#0a0a0d','text-align':'center','line-height': '40px'}"
          style="width: 100%;"
          :cell-style="{'text-align':'center'}">
          <el-table-column
            type="index"
            width="50">
          </el-table-column>

          <el-table-column
            prop="drugId"
            label="编号"
            width="120">
          </el-table-column>



          <el-table-column
            prop="druginfo.name"
            label="药品名称"
            width="180">
          </el-table-column>

          <el-table-column
            prop="druginfo.kind"
            label="处方类别"
            width="100">
          </el-table-column>

          <el-table-column
            prop="druginfo.specification"
            label="规格"
            width="100">
          </el-table-column>

          <el-table-column
            prop="druginfo.formulation"
            label="剂型"
            width="100">
          </el-table-column>

          <el-table-column
            prop="druginfo.manufacturer"
            label="生产厂家"
            width="180">
          </el-table-column>

          <el-table-column
            prop="repertory"
            label="库存"
            width="80">
          </el-table-column>

          <el-table-column
            prop="druginfo.purchasePrice"
            label="采购价"
            width="60">
          </el-table-column>

          <el-table-column
            prop="druginfo.retailPrice"
            label="零售价"
            width="60">
          </el-table-column>

          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                size="mini"
                @click="handleDelete(scope.$index, scope.row)">查看明细</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="block">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage4"
            :page-sizes="[5, 10, 15, 20]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="10">
          </el-pagination>
        </div>

      </el-card>
      <!--卡片end-->

    </el-col>
  </el-row>
</template>

<script>
  import axios from 'axios';
  export default {
    data() {
      return {
        druginfo:[],
        options: [{
          value: '选项1',
          label: '全部'
        }, {
          value: '选项2',
          label: '西/成药'
        }, {
          value: '选项3',
          label: '中药'
        }],
        input_search: '',
        druginfo:[],
        currentPage4: 4
      }
    },
    methods:{
      //分页
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      },
      //操作
      handleDelete(index, row) {
        console.log(index, row);
        this.$router.push("/drugInventoryDetail")
      },
      findAll:function () {
        axios.get("api/inventory/findAll").then(res=>{
          alert("8888");
        console.log(res.data);
        this.druginfo=res.data;
        })
      }
    },
    mounted(){
      this.findAll();
    }
  }
</script>

<style>
  .el-row {
    margin-bottom: 20px;
  &:last-child {
     margin-bottom: 0;
   }
  }
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: white;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
</style>

